<?php

declare(strict_types=1);

namespace App\DesignPatterns\Behavioral\Interpreter\Solution;

class DirectionExpression implements Expression
{
    private string $direction;

    public function __construct(string $direction)
    {
        $this->direction = $direction;
    }

    public function interpret(): string
    {
        return match ($this->direction) {
            'up' => '向上',
            'down' => '向下',
            'left' => '向左',
            'right' => '向右',
            default => '无效指令',
        };
    }
}